{% extends "projects/base.html" %}

{% block extrahead %}
{{ block.super }}
<link rel="alternate" type="application/rss+xml" title="{{project}} releases (rss)"
 href="{% url rss_feeds "releases" %}{{ project.slug}}/" />
<link rel="alternate" type="application/atom+xml" title="{{project}} releases (atom)" 
 href="{% url atom_feeds "releases" %}{{ project.slug}}/" />
{% endblock %}


{% block title %}{{project.name}} - {{block.super}}{% endblock %}


{% block projectcontent %} 

<h1>{{project.name}}</h1>

<span id="project_releases_feeds" class="feeds">
    release feeds: 
    <a class="feedlink" href="{% url rss_feeds "releases" %}{{ project.slug}}/" title="rss feed">
        <img class="feedicon" src="{{MEDIA_URL}}images/rss_icon.png" alt="rss icon"/>
    </a>
    <a class="feedlink" href="{% url atom_feeds "releases" %}{{ project.slug}}/" title="atom feed">
        <img class="feedicon" src="{{MEDIA_URL}}images/atom_icon.png" alt="atom icon"/>
    </a>
    {% subscription_link request "pr" project.id %}
</span>

{% if can_vote %}
<form action="" method="post" id="potm-form">
<p>
    <input type="hidden" name="potm-vote"/>
    <input type="submit" value="vote for {{project.name}} for the project of the month" 
           class="button" onclick="return ajax_voting();"/>
</p>
</form>
{% endif %}

<h2>Summary</h2>

{{project.raw_summary|safe}}

<div id="project-screenshots">
<h2>Screenshots</h2>
{% if screenshots %}
<div class="thumb_list">
    <ul>
      {% for screenshot in screenshots %}
      <li><table cellpadding="0" cellspacing="0" border="0">
         <tr><td><div class="thumb_shadow">
           <a title="{{screenshot.name}}" href="{{screenshot.get_absolute_url}}">
            {{screenshot.preview}}
           </a>
        </div></td></tr></table>
      </li>
      {% endfor %}
    </ul>
	<br/>
</div>
{% else %}
    <p>
      There are no screenshots for this project.
    </p>
{% endif %}

{% if has_member_perm %}
    {% if priv_screenshots %} 
        <h3>non-public Screenshots</h3>
		<div class="thumb_list">
        <ul>
          {% for screenshot in priv_screenshots %}
		<li><table cellpadding="0" cellspacing="0" border="0">
			<tr><td><div class="thumb_shadow"><a href="{{screenshot.get_absolute_url}}">
               {{screenshot.preview}}
            </a></div></td></tr></table>
          </li>
          {% endfor %}
        </ul>
		<br/>
		</div>
    {% endif %}
    <a href="{% url add_screenshot project.slug %}">add Screenshot</a>
{% endif %}

</div>


<h2>Videos</h2>
{% if project.video_set.all %}
{% for video in project.video_set.all %}
<div class="thumb_list">
<ul>
	<li><table cellpadding="0" cellspacing="0" border="0">
		<tr><td><div class="thumb_shadow">
		<a href={{video.get_absolute_url}} title="{{video.name}}">{{video.preview}}
		</a></div></td></tr></table>
</li></ul>
</div>
{% endfor %}
{% else %}
There are no videos for this project.
{% endif %}
{% if has_member_perm %}
    <br/>
    <a href="{% url add_video project.slug %}">add Video</a>
{% endif %}



<div id="project-team">
    <h2>Team</h2>
    Admin{{project.admins.all|pluralize}}:
    {{project.admins.all|userlist}}
    {% if project.members.count %}
    <br/>
    Member{{project.members.all|pluralize}}:
    {{project.members.all|userlist}}
    {% endif %}
    
</div>

<h2>Website</h2>
<a href="{{project.homepage_link}}">{{project.homepage_link}}</a>

{% tags_for_object project as tags %}
{% if tags %}
<h2>Tags</h2>
{% taglist tags "project_tag_page" %}
{% endif %}


<h2 id="potm">Project of the Month</h2>
{% if won_potm %}
{{project}} was project of the following month{{won_potm|pluralize}}:
<ul>
{% for potm in won_potm %}
<li><a href="{{potm.get_absolute_url}}">{{potm.get_date}}</a></li>
{% endfor %}
</ul>
{% else %}
{{project.name}} was not yet project of any month.
{% endif %}

<h2>Description</h2>
{{project.raw_description|safe}}

{% if release %}
<h2 id="release">Release Details for {{release}} {{releasename_extra}}</h2>
<dl>
    <dt>Release Date:</dt><dd>{{release.created|localtime:request}}</dd>
    <dt>Released by: </dt><dd>{{release.creator|userlink}}</dd>
    <dt>Download: </dt><dd><a href="{{release.download_url}}">{{release.download_url}}</a></dd>
    {% if release.notes_url %}
      <dt>Release notes: </dt><dd><a href="{{release.notes_url}}">{{release.notes_url}}</a></dd>
    {% endif %}
</dl>

{% if release.raw_summary %}
<h3>Summary</h3>
{{release.raw_summary|safe}}
{% endif %}

{% if release.raw_changelog %}
<h3>Changelog</h3>
{{release.raw_changelog|safe}}
{% endif %}

{% ifnotequal releases|length 1 %}
<h2>Other releases</h2>
<ul>
{% for alt_release in releases %}
  {% ifnotequal release alt_release %}
  <li><a href="{{alt_release.get_absolute_url}}">{{project.name}} {{alt_release.version}}</a></li>
  {% endifnotequal %}
{% endfor %}
</ul>
{% endifnotequal %}

{% else %}

<h2>Releases</h2>
No releases available for {{project.name}}<br/>
{% endif %}

<br/>
<p>
Project created by {{project.creator|userlink}} at {{project.created|localtime:request}}<br/>
Last edited by {{project.last_editor|userlink}} at {{project.last_edited|localtime:request}}<br/>
</p>
<br/>

{%include "comments/comments.html"%}
{% if has_admin_perm %}
admin options:
<a href="{% url edit_project project.slug%}" class="actionlink">edit project</a>
{% else %}
  {% if has_member_perm %}de
  project member options:
  {% endif %}
{% endif %}
{% if has_member_perm %}
  {% if release %}
  <a href="{% url edit_release project.slug release.slug %}" class="actionlink">edit release</a>
  <a href="{% url delete_release project.slug release.slug %}" class="actionlink">delete release</a>
  {% endif %}
<a href="{% url add_release project.slug %}" class="actionlink">release new version</a>

{% endif %}
{% endblock %} 
 
